package edu.xlh.travel.dao;

import edu.xlh.travel.pojo.TotalScore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface TotalScoreDao  extends JpaRepository<TotalScore,String>, JpaSpecificationExecutor<TotalScore> {
    TotalScore findByUserId(String userId);

    @Modifying
    @Query(value = "update t_total_score set total_score =?2"+" + total_score where id = ?1", nativeQuery=true)
    void updateTotalScoreByUserId(String id, Integer totalScore);

    @Modifying
    @Query(value = "update t_total_score set total_score = ?2 where user_id = ?1", nativeQuery=true)
    void updateTotalScoreByUserIdForPay(String id, String totalScore);
}
